package com.woniuxy.automotivemanagementsystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/*
* 用户表
*
* */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")
public class User {
    @TableId(value = "uid",type = IdType.AUTO)
    private Integer uid;//用户 id
    private String username;//用户名
    private String password;//密码
    private String type;//用户类型  管理员/普通用户/svip
//    @TableLogic(value = "0",delval = "1")
    private Integer status;//状态  0正常/1注销
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createtime;//创建时间
    private String imgPath;//头像路径
    @TableField(exist = false)
    private List< Role> roles;

    /*
    * 拦截器更新Token需要的构造函数
    * */
    public User(Integer id, String password) {
        this.uid = id;
        this.password = password;
    }
}
